# 案例1:
# 注意，如果有默认参数，默认参数一定放在位置参数后面
# def show_info(name, age, height, weight, gender="男"):
#     print("*" * 20)
#     print(f"【姓名：{name}】")
#     print(f"【年龄：{age}】")
#     print(f"【身高：{height}】")
#     print(f"【体重：{weight}】")
#     print(f"【性别：{gender}】")
#     print("*" * 20)
#
#
# show_info("yuan", 18, 198, 70)
# show_info("alex", 48, 158, 90)
# show_info("june", 78, 158, 90, "女")


# 案例2:


# def cal_cart_total(cart, discount=0.8):
#     total = 0
#     for goods in cart:
#         total += goods["price"] * goods["quantity"]
#
#     total = round(total * discount)
#
#     print(total)
#
#
# shopping_cart01 = [
#     {
#         "name": "mac电脑",
#         "price": 14999,
#         "quantity": 1
#     },
#     {
#         "name": "iphone15",
#         "price": 9980,
#         "quantity": 3
#     }
# ]
# shopping_cart02 = [
#     {
#         "name": "mac电脑",
#         "price": 14999,
#         "quantity": 3
#     },
#     {
#         "name": "iphone15",
#         "price": 9980,
#         "quantity": 13
#     }
# ]
# shopping_cart03 = [
#     {
#         "name": "mac电脑",
#         "price": 14999,
#         "quantity": 7
#     },
#     {
#         "name": "iphone15",
#         "price": 9980,
#         "quantity": 8
#     }
# ]
#
# cal_cart_total(shopping_cart01)
# cal_cart_total(shopping_cart02)
# cal_cart_total(shopping_cart03, 0.1)
